package com.tm.media.controller;

import com.tm.media.model.entity.NewsEntity;
import com.tm.media.service.NewsService;
import com.tm.media.utils.utils.PageUtil;
import com.tm.media.utils.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Ly
 * @Data 2023/2/22 14:15
 * @ClassName NewsController
 */
@RestController
@RequestMapping("api/v1/media/news/")
public class NewsController {
    @Autowired
    private NewsService newsService;
    @PostMapping("/list")
    public Result list(@RequestBody PageUtil pageUtil){
            return newsService.newList(pageUtil);
    }
    @PostMapping("/submit")
    public  Result submit(@RequestBody NewsEntity newsEntity){
        return newsService.submit(newsEntity);
    }
    @PostMapping("/del_news")
    public Result del_news(@RequestBody NewsEntity newsEntity){
        return newsService.del_news(newsEntity);
    }
    @PostMapping("news")
    public  Result news(@RequestBody NewsEntity newsEntity){
        return newsService.news(newsEntity);
    }
}
